import React, { useState,useEffect } from "react";
import {
  Typography,
  IconButton,
  Button,
  Card,
  CardContent,
  Avatar,
  Box,
  Grid,
  Chip,
  Divider,
  List,
  ListItem,  
  CssBaseline, 
  ListItemButton,
  ListItemIcon,
  ListItemText,
  Paper,
  Tabs,
  Tab,
  Container,
  Table,
  TableBody,
  TableCell,
  TableContainer,
  TableHead,
  TableRow,
  Menu,
  MenuItem
} from "@mui/material";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import DownloadIcon from "@mui/icons-material/Download";
import FavoriteIcon from "@mui/icons-material/Favorite";
import WhatshotIcon from "@mui/icons-material/Whatshot";
import EmojiEventsIcon from "@mui/icons-material/EmojiEvents";
import RecommendUnder from "../components/recommendUnder";
import MailIcon from "@mui/icons-material/Mail";
import InfoIcon from "@mui/icons-material/Info";
import TextField from '@mui/material/TextField';
import ThumbUpAltIcon from '@mui/icons-material/ThumbUpAlt';
import ReplyIcon from '@mui/icons-material/Reply';
import CommentIcon from "@mui/icons-material/Comment";
import DownloadDoneIcon from "@mui/icons-material/DownloadDone";
import FolderIcon from "@mui/icons-material/Folder";
import Navbar from "../components/Navbar";
import {Link, useLocation, useNavigate } from "react-router-dom";
import { Dialog, DialogTitle, DialogContent, DialogActions } from "@mui/material";
import { getSeedById,getSeedType,downloadFile } from "../api/seed";
import { useParams } from "react-router-dom";
import BASE_URL from "../config";
import { getUserInfo,getUserName} from "../api/user";
import { postComment,likeComment,unlikeComment,getSeedComments } from "../api/seed";
import { navigationItems } from '../App';

const SeedDetailPage = () => {
  const { seedId } = useParams();
  const userId = localStorage.getItem("id");
  const navigate = useNavigate();
  const [open, setOpen] = useState(false);
  const [giftType, setGiftType] = useState(null);  // 去掉类型注释
  const [quantity, setQuantity] = useState(1);
  const [selectedUser,setSelectedUser] = useState({});
  const [anchorEl, setAnchorEl] = React.useState(null);
  const [coverImageA,setCoverImageA] = useState();
  const [uploaderName,setUploaderName] = useState('');
const [userInfo, setUserInfo] = useState({
  avatar: '/default/avatar.png',
  username: '游客',
});  
const [seedDescribe, setSeedDescribe] = useState({
  id: 11,
  name: "未命名",
  type: "游戏",
  firsttype: "PC",
  secondtype: "角色扮演",
  thirdtype: "安装包",
  fourthtype: "简体中文",
  describe: "无\n",
  cost: "2yt",
  torrentFile: "test.torrent",
  size: "20GB",
  downloads: 0,
  seednum: 0,
  download: 0,
  updatetime: "2025-05-22",
  uploaderId: 0
});
const [comments, setComments] = useState([

]);
  const [seedDetail, setSeedDetail] = useState(
    {
      comments: 2,
      purchased: 19,
      releaseTime: "2025/3/20",
      lastEditTime: "16:30",
      seed_id: "3221415",
      seeder: "Example Seeder",
      seederAvatar: "Example Avatar Link",
      uploaderId: 0,
      seedDescription: "This is an example seed description.",
      torrent_size: "7.5 GB"}
  );
  const [loading, setLoading] = useState(true);
  const [fileList, setFileList] = useState([
        { filename: "Episode1.mkv", size: "2 GB" },
        { filename: "Episode2.mkv", size: "2.1 GB" },
      ]);
  const [infohash,setInfohash] = useState();
  const [downloadData, setDownloadData] = useState([
        {
          username: "Downloader1",
          user_level: "普通会员",
          uid: "10001",
          download_time: "2024-04-20 12:00"
        },
      ]);
  const [seedingData, setSeedingData] = useState([
        {
          username: "Uploader1",
          user_level: "高级会员",
          uploaded: "10 GB",
          upload_speed: "500 KB/s",
          downloaded: "1 GB",
          download_speed: "50 KB/s",
          progress: "100%",
          last_active: "5分钟前",
          created_at: "2024-04-01",
          client: "qBittorrent (端口: 12345)"
        },
      ]);
useEffect(() => {
  const fetchSeedDetail = async () => {
    try {

      const userInfo_get = await getUserInfo(localStorage.getItem('token'));
      setUserInfo(userInfo_get);
          console.log("info",userInfo_get);
        
      const response = await getSeedById(seedId); 
      // const data = response[0];
      const data = response;
      console.log("hashadkadata=",data);
      console.log("sadafaf:",data.torrent.infoHash);
      setInfohash(data.torrent.infoHash);
      const typeRes = await getSeedType(seedId);
      console.log("tpyeres!",typeRes);
      setSeedDescribe(typeRes.torrent);
      setCoverImageA(typeRes.coverImageBase64);
      setSeedDetail(data.torrent || []);
      setDownloadData(data.downloaders || []);
      setSeedingData(data.seeders || []);
      const dataUser = await getUserName(data.torrent.uploaderId);
      console.log('reply',dataUser);
      setUploaderName(dataUser.username);

      console.log("sfafafsdaf");
      const comments_from_back = await getSeedComments(seedId,userId);
      setComments(comments_from_back);
    } catch (err) {
      console.error("加载种子详情失败:", err);
    } finally {
      setLoading(false);
    }
  };

  fetchSeedDetail();
}, [seedId]);
  const handleOpen = (type) => {
    setGiftType(type);
    setQuantity(1);  // 打开弹框时默认数量为1
    setOpen(true);
  };

  const handleClose = () => {
    setOpen(false);
    setGiftType(null);
  };
const handleDownload = async (infohash) => {
  try {
    const response = await downloadFile(infohash);
    console.log(response);

    let filename = 'download_file.torrent';

    if (response.headers) {
      const contentDisposition = response.headers['content-disposition'];
      if (contentDisposition) {
        console.log("!!!!!!!!!!!!!")
        const matches = contentDisposition.match(/filename\*?=(?:UTF-8'')?"?([^"]+)"?/);
        if (matches && matches[1]) {
          filename = decodeURIComponent(matches[1]);
        }
      }
    }

    const blob = new Blob([response.data]);
    const url = window.URL.createObjectURL(blob);
    const link = document.createElement('a');
    link.href = url;
    link.setAttribute('download', filename);
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
    window.URL.revokeObjectURL(url);
  } catch (error) {
    console.error('下载失败：', error);
    alert('下载失败，请稍后再试');
  }
};


  const handleConfirm = () => {
    // 这里放赠送逻辑
    alert(`赠送了 ${quantity} 个 ${giftType === "points" ? "积分" : "杨桃"}`);
    handleClose();
  };
    const sender = [
          { id: 11, nickname: '小红', avatar: '/CCB.png', email: 'hong@example.com' },
    ];
    

      

const [newComment, setNewComment] = useState("");
const handlePostComment = async () => {
    if (!newComment.trim()) return;
    try {
      const newItem = {
        seedId: Number(seedId),
        userId: Number(userId),
        username: userInfo.username,
        avatar: userInfo.avatar|| '/default-avatar.png',
        content: newComment,
        timestamp: new Date().toISOString(),
      };
      console.log(userInfo);
      const res = await postComment(newItem);
      console.log(res);
      setComments([res.data, ...comments]);
      setNewComment('');
    } catch (err) {
      console.error('发表评论失败:', err);
    }
  };


  const [loadingStates, setLoadingStates] = useState({
    like: {},
    reply: {}
  });
const handleToggleLike = async (commentId) => {
  try {
    setLoadingStates(prev => ({ ...prev, like: { ...prev.like, [commentId]: true } }));

    const comment = comments.find(c => c.id === commentId);
    const isLiked = comment.liked;

    const res = isLiked
      ? await unlikeComment(commentId, Number(userId))
      : await likeComment(commentId, Number(userId));

    setComments(prevComments =>
      prevComments.map(comment =>
        comment.id === commentId
          ? {
              ...comment,
              liked: res.liked,       // 从接口取
              likeCount: res.likeCount
            }
          : comment
      )
    );
  } catch (err) {
    console.error('操作失败:', err);
  } finally {
    setLoadingStates(prev => ({ ...prev, like: { ...prev.like, [commentId]: false } }));
  }
};


  // 回复评论
  //需要修改回复评论的具体内容！！！改成批评论可以显示头像和名字
    
      
    
 
    
    const [selected,setSelected] = useState('seedInfo');

    const location = useLocation();
    const handleClick = (value) => {
        setSelected(value); 
      };
    const handleOpenChat = (user) => {
      
    const userForMessage = {
      id: seedDetail.uploaderId ,
      name: uploaderName ,
      avatar: user.seederAvatar ,
    };
    // const userForMessage = {
    //   id: 10 ,
    //   name: 'hitomi' ,
    //   avatar: user.seederAvatar ,
    // };
  navigate('/message', { state: { user: userForMessage } });
};
    const renderContent = () => {
        switch (selected) {
          case "seedInfo":
  const {
    name,
    description,
    fileSize,
    cost,
    firsttype,
    secondtype,
    thirdtype,
    fourthtype,
    updatetime,
    createTime

  } = seedDescribe || {};

  return (
    <Paper
      elevation={4}
      sx={{
        borderRadius: 3,
        p: 4,
        maxWidth: 1050,
        mx: "auto",
        bgcolor: "#f5f7fa",
        boxShadow: "0 8px 20px rgba(0,0,0,0.12)",
        display: "flex",
        flexDirection: "column",
        gap: 4,
      }}
    >
      {/* 左侧封面 */}
      
        <img
          src={coverImageA}
         style={{
                width: '100%',
                height: 140,      // 稍微高点更好看
                borderRadius: 8,
                objectFit: 'cover',
              }}
            onError={(e) => {
    e.target.onerror = null; // 防止无限循环
    e.target.src = "默认图片地址"; // 显示默认图
    console.log("图片加载失败，base64：", coverImageA);
  }}
          sx={{
            width: { xs: "100%", md: "100%" },
            height: "auto",
            borderRadius: 2,
            boxShadow: "0 4px 15px rgba(0,0,0,0.1)",
            objectFit: "cover",
          }}
        />

      {/* 右侧内容 */}
      <Box
        sx={{
          flex: 1,
          display: "flex",
          flexDirection: "column",
          justifyContent: "flex-start",
          gap: 2,
        }}
      >
        {/* 标题 */}
        <Typography variant="h4" fontWeight="700" color="primary.main">
          {name || "未命名种子"}
        </Typography>

        {/* 描述 */}
        <Typography
          variant="body1"
          sx={{ whiteSpace: "pre-wrap", color: "#444", lineHeight: 1.6 }}
          paragraph
        >
          {description || "暂无描述"}
        </Typography>

        {/* 详细信息列表 */}
        <Box
          sx={{
            display: "grid",
            gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" },
            gap: 1.5,
            mt: 1,
          }}
        >
          <Typography variant="subtitle2" color="text.secondary">
            <strong>大小：</strong> {fileSize || "未知"}
          </Typography>
          <Typography variant="subtitle2" color="text.secondary">
            <strong>价格：</strong> {cost || "免费"}
          </Typography>
          <Typography variant="subtitle2" color="text.secondary">
            <strong>类型：</strong> {seedDetail.firstType || "-"} / {seedDetail.secondType || "-"} /{" "}
            {seedDetail.thirdType || "-"} / {seedDetail.fourthType || "-"}
          </Typography>
          <Typography variant="subtitle2" color="text.secondary">
            <strong>更新时间：</strong> {updatetime || createTime}
          </Typography>
        </Box>
      </Box>
    </Paper>
  );

          case "seedComment":
            return(
            <Paper elevation={3} sx={{ 
                borderRadius: 4, 
                overflow: "hidden",
                p: 4,                        // 增加内边距
                display: "flex",             // 使用flex布局
                flexDirection: "column",     // 垂直方向排列
                justifyContent: "center",    // 垂直居中
                alignItems: "center",        // 水平居中
                height: "100%",              // 保持高度一致
                textAlign: "center",         // 文字居中
                width:"1050px"
            }}>
              {/* 发布评论 */}
              <Box
                sx={{
                  display: "flex",
                  alignItems: "center",
                  mb: 4,
                  gap: 2,
                  p: 2,
                  backgroundColor: "#fff",
                  borderRadius: 2,
                  boxShadow: 1,
                  width: "100%"
                }}
              >
                <Avatar src="/CCB.png" />
                <TextField
                  fullWidth
                  placeholder="写下你的评论..."
                  value={newComment}
                  onChange={(e) => setNewComment(e.target.value)}
                  size="small"
                  multiline
                  minRows={3}  // 多行输入，最少3行高
                />
                <Button variant="contained" onClick={handlePostComment}>
                  发布
                </Button>
              </Box>

              {/* 评论列表 */}
          <Box sx={{ 
            display: "flex", 
            flexDirection: "column", 
            gap: 4, 
            width: "100%"            // 让评论列表宽度撑满外层Paper宽度 
          }}>
                {[...comments].sort((a, b) => b.likeCount - a.likeCount).map(comment => (
                  <Paper
                    key={comment.id}
                    elevation={2}
                    sx={{
                      p: 3,
                      borderRadius: 3,
                      backgroundColor: "#ffffff",
                      minHeight: 100,
                      maxWidth: "900px",
                      wordBreak: "break-word",
                      whiteSpace: "pre-line"
                    }}
                  >
                    <Box
                      sx={{ display: "flex", gap: 2, alignItems: "center", mb: 1 }}
                    >
                      <Avatar
                        src={comment.avatar}
                        alt={comment.username}
                        sx={{ cursor: "pointer" }}
                        onClick={(e) => {
                          e.stopPropagation();
                          setSelectedUser({
                            seederId: comment.userId,
                            seeder: comment.username,
                            seederAvatar: comment.avatar
                          });
                          setAnchorEl(e.currentTarget); // 记录当前头像的DOM元素
                        }}

                      />
                      <Menu
                        anchorEl={anchorEl}
                        open={Boolean(anchorEl)}
                        onClose={() => {
                          setSelectedUser(null);
                          setAnchorEl(null);
                        }}
                      >
                        <MenuItem onClick={() => {
                          handleOpenChat(selectedUser);
                          setAnchorEl(null);
                          setSelectedUser(null);
                        }}>
                          私信
                        </MenuItem>
                      </Menu>

                      <Box>
                        <Typography fontWeight="bold" align="left">{comment.username}</Typography>
                        <Typography variant="caption" color="text.secondary">
                          {new Date(new Date(comment.timestamp).getTime() ).toLocaleString()}
                        </Typography>

                      </Box>
                    </Box>

                    <Typography
                      sx={{
                        mb: 1,
                        minHeight: "60px",
                        lineHeight: 1.6,
                        fontSize: "1rem",
                        whiteSpace: "pre-wrap",
                        overflowWrap: "break-word"
                      }}
                    >
                      {comment.content}
                    </Typography>

                    {/* 点赞 & 回复 */}
                    
                  </Paper>
                ))}
              </Box>
            </Paper>
            );
          case "seedingComplete":
            return (
              <Paper elevation={3} sx={{ 
                borderRadius: 4, 
                overflow: "hidden",
                p: 4,                        // 增加内边距
                display: "flex",             // 使用flex布局
                flexDirection: "column",     // 垂直方向排列
                justifyContent: "center",    // 垂直居中
                alignItems: "center",        // 水平居中
                height: "100%",              // 保持高度一致
                textAlign: "center",         // 文字居中
                width:"1050px"
            }}>
                <TableContainer>
                  <Table>
                    <TableHead>
                      <TableRow>
                        <TableCell>用户名</TableCell>
                        <TableCell>用户id</TableCell>
                        <TableCell>已上传</TableCell>
                        <TableCell>已下载</TableCell>
                        <TableCell>最后活动时间</TableCell>
                        <TableCell>创建时间</TableCell>
                        <TableCell>客户端ip</TableCell>
                        <TableCell>客户端端口</TableCell>
                      </TableRow>
                    </TableHead>
                    <TableBody>
                      {seedingData.map((row, index) => (
                        <TableRow key={index}>
                          <TableCell>{row.username}</TableCell>
                          <TableCell>{row.peerId}</TableCell>
                          <TableCell>{row.uploaded}</TableCell>
                          <TableCell>{row.downloaded}</TableCell>
                          <TableCell>{row.lastUpdated}</TableCell>
                          <TableCell>{row.torrent.createTime}</TableCell>
                          <TableCell>{row.ip}</TableCell>
                          <TableCell>{row.port}</TableCell>
                        </TableRow>
                      ))}
                    </TableBody>
                  </Table>
                </TableContainer>
              </Paper>
            );
    
          case "download":
            return (
              <Paper elevation={3} sx={{ 
                borderRadius: 4, 
                overflow: "hidden",
                p: 4,                        // 增加内边距
                display: "flex",             // 使用flex布局
                flexDirection: "column",     // 垂直方向排列
                justifyContent: "center",    // 垂直居中
                alignItems: "center",        // 水平居中
                height: "100%",              // 保持高度一致
                textAlign: "center",         // 文字居中
                width:"1050px"
            }}>
                <TableContainer>
                  <Table>
                    <TableHead>
                      <TableRow>
                        <TableCell>用户名</TableCell>
                        <TableCell>种子id</TableCell>
                        <TableCell>UID</TableCell>
                        <TableCell>下载完成时间</TableCell>
                      </TableRow>
                    </TableHead>
                    <TableBody>
                      {downloadData.map((row, index) => (
                        <TableRow key={index}>
                          <TableCell>{row.username}</TableCell>
                          <TableCell>{row.torrentId}</TableCell>
                          <TableCell>{row.userId}</TableCell>
                          <TableCell>{row.createdAt}</TableCell>
                        </TableRow>
                      ))}
                    </TableBody>
                  </Table>
                </TableContainer>
              </Paper>
            );
    
          // case "seedFile":
          //   return (
          //     <Paper elevation={3} sx={{ 
          //       borderRadius: 4, 
          //       overflow: "hidden",
          //       p: 4,                        // 增加内边距
          //       display: "flex",             // 使用flex布局
          //       flexDirection: "column",     // 垂直方向排列
          //       justifyContent: "center",    // 垂直居中
          //       alignItems: "center",        // 水平居中
          //       height: "100%",              // 保持高度一致
          //       textAlign: "center",         // 文字居中
          //       width:"1050px"
          //   }}>
          //       <TableContainer>
          //         <Table>
          //           <TableHead>
          //             <TableRow>
          //               <TableCell>文件名</TableCell>
          //               <TableCell>大小</TableCell>
          //             </TableRow>
          //           </TableHead>
          //           <TableBody>
          //             {fileList.map((file, index) => (
          //               <TableRow key={index}>
          //                 <TableCell>{file.filename}</TableCell>
          //                 <TableCell>{file.size}</TableCell>
          //               </TableRow>
          //             ))}
          //           </TableBody>
          //         </Table>
          //       </TableContainer>
          //     </Paper>
          //   );
    
          default:
            return null;
        }
      };
    return (
    <div className="SeedDetail">
        <CssBaseline />
        <Navbar />
      <Container maxWidth="lg" sx={{ paddingTop: 3 }}>
                <Box sx={{ maxWidth: '1400px', mx: 'auto' }}>
                    <Tabs 
                    value={location.pathname}
                    indicatorColor="primary"
                    textColor="primary"
                    variant="scrollable"
                    scrollButtons="auto"
                    >
                    {navigationItems.map((item) => (
                        <Tab
                        key={item.path}
                        label={item.label}
                        value={item.path}
                        component={Link}
                        to={item.path}
                        sx={{ 
                            minWidth: 100,
                            '&.Mui-selected': { fontWeight: 'bold' }
                        }}
                        />
                    ))}
                    </Tabs>
                    </Box>
            </Container>
        
    <Container maxWidth="false" sx={{ mt: 3 }}>
          <Box sx={{ maxWidth: '1300px', mx: 'auto' }}>
        <Paper elevation={3} sx={{ p: 3, mb: 3 }}>
                    {/* 上方信息 */}
                    <Box sx={{ display: "flex", alignItems: "center", mb: 3 }}>
                      <Avatar
                        sx={{
                          width: 72,
                          height: 72,
                          mr: 3,
                          boxShadow: 3,
                        }}
                        src={seedDetail.seederAvatar} // 从sender数组第一个对象取avatar
                      />
                      <Box>
                        <Typography
                          variant="h5"
                          fontWeight="bold"
                          gutterBottom
                          sx={{
                            whiteSpace: "nowrap",
                            overflow: "hidden",
                            textOverflow: "ellipsis",
                          }}
                        >
                          {seedDescribe.fileName}
                        </Typography>

                        <Typography variant="body2" color="text.secondary">
                          发帖人: {uploaderName}  {/* 显示昵称 */}
                        </Typography>
                      </Box>
                    </Box>

                    {/* 按钮行 */}
                    <Box sx={{ display: "flex", flexWrap: "wrap", gap: 2, mb: 3 }}>
                        <Chip label={`大小：${seedDetail.torrent_size}`} color="primary" />
                        <Button
                          variant="contained"
                          color="success"
                          startIcon={<DownloadIcon />}
                          onClick={() => handleDownload(seedId)}  
                          sx={{
                            borderRadius: 3,
                            boxShadow: 2,
                            transition: "0.3s",
                            "&:hover": { transform: "scale(1.05)" },
                          }}
                        >
                          下载种子
                        </Button>
                        {/* <Button
                        variant="contained"
                        color="error"
                        startIcon={<FavoriteIcon />}
                        sx={{
                            borderRadius: 3,
                            boxShadow: 2,
                            transition: "0.3s",
                            "&:hover": { transform: "scale(1.05)" },
                        }}
                        >
                        收藏
                        </Button>
                       <Button
                          variant="contained"
                          color="warning"
                          startIcon={<WhatshotIcon />}
                          sx={{
                            borderRadius: 3,
                            boxShadow: 2,
                            transition: "0.3s",
                            "&:hover": { transform: "scale(1.05)" },
                            mr: 2
                          }}
                          onClick={() => handleOpen("points")}
                        >
                          赠送积分
                        </Button>

                        <Button
                          variant="contained"
                          color="secondary"
                          startIcon={<EmojiEventsIcon />}
                          sx={{
                            borderRadius: 3,
                            boxShadow: 2,
                            transition: "0.3s",
                            "&:hover": { transform: "scale(1.05)" },
                          }}
                          onClick={() => handleOpen("starfruit")}
                        >
                          赠送杨桃
                        </Button> */}

                        {/* <Dialog open={open} onClose={handleClose}>
                          <DialogTitle>{giftType === "points" ? "赠送积分" : "赠送杨桃"}</DialogTitle>
                          <DialogContent>
                            <TextField
                              label="赠送数量"
                              type="number"
                              value={quantity}
                              onChange={(e) => setQuantity(Math.max(1, Number(e.target.value)))}
                              inputProps={{ min: 1 }}
                              fullWidth
                              autoFocus
                              sx={{ mt: 1, mb: 1 }}
                            />
                          </DialogContent>
                          <DialogActions>
                            <Button onClick={handleClose}>取消</Button>
                            <Button variant="contained" onClick={handleConfirm}>确认赠送</Button>
                          </DialogActions>
                        </Dialog> */}
                        <Button
                        variant="contained"
                        color="info"
                        startIcon={<MailIcon />}
                        sx={{
                            borderRadius: 3,
                            boxShadow: 2,
                            transition: "0.3s",
                            "&:hover": { transform: "scale(1.05)" },
                        }}
                        onClick={() => handleOpenChat(seedDetail)}
                        >
                        私信联系
                        </Button>
                    </Box>

                    <Box sx={{ mb: 2 }}>
                      <Typography variant="body2" color="text.secondary">
                        发布时间: {seedDetail.createTime || '未知'}&nbsp;|&nbsp;
                        最后编辑时间: {seedDetail.updateTime || seedDetail.createTime||'未知'}&nbsp;|&nbsp;
                        种子ID: {seedDetail.id || '未知'}
                      </Typography>
                    </Box>

                <Grid container spacing={3} wrap="nowrap"> 
                    <Grid item xs={12} md={3} sm={3}>
                    <Paper elevation={3} sx={{ borderRadius: 4, overflow: "hidden" }}>
            <List component="nav">
              <ListItem disablePadding>
                <ListItemButton
                  onClick={() => handleClick("seedInfo")}
                  selected={selected === "seedInfo"} // 判断是否选中
                  sx={{
                    backgroundColor: selected === "seedInfo" ? "blue" : "transparent", // 高亮背景
                    "&:hover": { backgroundColor: "lightblue" }, // 鼠标悬停高亮
                  }}
                >
                  <ListItemIcon>
                    <InfoIcon />
                  </ListItemIcon>
                  <ListItemText primary="种子简介" />
                </ListItemButton>
              </ListItem>

              
{/* 
              <ListItem disablePadding>
                <ListItemButton
                  onClick={() => handleClick("seedFile")}
                  selected={selected === "seedFile"}
                  sx={{
                    backgroundColor: selected === "seedFile" ? "blue" : "transparent",
                    "&:hover": { backgroundColor: "lightblue" },
                  }}
                >
                  <ListItemIcon>
                    <DownloadIcon />
                  </ListItemIcon>
                  <ListItemText primary="种子文件" />
                </ListItemButton>
              </ListItem> */}

              <ListItem disablePadding>
                <ListItemButton
                  onClick={() => handleClick("download")}
                  selected={selected === "download"}
                  sx={{
                    backgroundColor: selected === "download" ? "blue" : "transparent",
                    "&:hover": { backgroundColor: "lightblue" },
                  }}
                >
                  <ListItemIcon>
                    <DownloadDoneIcon />
                  </ListItemIcon>
                  <ListItemText primary="下载" />
                </ListItemButton>
              </ListItem>
                <ListItem disablePadding>
                <ListItemButton
                  onClick={() => handleClick("seedComment")}
                  selected={selected === "seedComment"}
                  sx={{
                    backgroundColor: selected === "seedComment" ? "blue" : "transparent",
                    "&:hover": { backgroundColor: "lightblue" },
                  }}
                >
                  <ListItemIcon>
                    <CommentIcon />
                  </ListItemIcon>
                  <ListItemText primary="种子评论" />
                </ListItemButton>
              </ListItem>
              <ListItem disablePadding>
                <ListItemButton
                  onClick={() => handleClick("seedingComplete")}
                  selected={selected === "seedingComplete"}
                  sx={{
                    backgroundColor: selected === "seedingComplete" ? "blue" : "transparent",
                    "&:hover": { backgroundColor: "lightblue" },
                  }}
                >
                  <ListItemIcon>
                    <FolderIcon />
                  </ListItemIcon>
                  <ListItemText primary="做种完成" />
                </ListItemButton>
              </ListItem>
            </List>
          </Paper>
                </Grid>
                <Grid item xs={12} md={9} sm={9}>
                    {/* 详细介绍 */}
                        

                        {renderContent()}
                    </Grid>
                </Grid>
        </Paper>
                          <RecommendUnder  infohash={infohash}/>

        </Box>
        </Container>
    </div>
  );
};

export default SeedDetailPage;
